package org.smr.ministore.dao;

import org.apache.ibatis.annotations.Param;
import org.smr.ministore.entities.Authority;
import org.apache.ibatis.annotations.Mapper;
import org.blade.dao.base.BaseMapper;
import org.blade.dao.base.PageQueryMapper;

import java.util.List;

/**
*
**/
@Mapper
public interface AuthorityMapper extends BaseMapper<Long, Authority>,PageQueryMapper<Long,Authority> {

    /**
     * 根据父权限与类型查询
     * @param parentId
     * @param type
     * @return
     */
    List<Authority> selectByParentAndType( @Param("parentId") Long parentId, @Param("type") Integer type );

    /**
     * 根据用户查询权限
     * @param userId
     * @return
     */
    List<Authority> selectByUser( @Param("userId") Long userId );

    /**
     * 根据角色查询
     * @param roleId
     * @return
     */
    List<Authority> selectByRoles( @Param("roleIds") Long... roleId );


    /**
     * 根据角色 与 用户查询权限
     * @param userId
     * @param roleIds
     * @return
     */
    List<Authority> selectByUserAndRoles( @Param("userId") Long userId , @Param("roleIds") Long... roleIds  );

}
